<?php

namespace Utuo;

class PVReport {
	
	/**
	 * 记录客户PV
	 *
	 * @param integer $cid
	 */
	public static function report($cid) {
		$date = date('Ymd');
		$data = array (
				'cid' => $cid,
				'date' => $date 
		);
		M('Customer')->where('id=%d',$cid)->setInc('pv',1);
		$m = M('CustomerReport');
		$report = $m->where($data)->find();
		if (empty($report)) {
			$data['pv'] = 1;
			$m->add($data);
		} else {
			$m->where('id=%d',$report['id'])->setInc('pv',1);
		}
	}
}